{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "33e872bb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['cd', 'ef']\n",
      "['ab', 'cd']\n",
      "['ab', 'cd']\n",
      "[]\n",
      "[1, 4, 7]\n",
      "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n"
     ]
    }
   ],
   "source": [
    "# -*- coding: utf-8 -*-\n",
    "# Author : Hongzhou\n",
    "# Data : 2021/9/27 11:24\n",
    "\n",
    "# name = \"hongzhou, zhifeng, jiayu, kaiguang\"\n",
    "# print(names[1])\n",
    "users_list = [\"hongzhou\",\"zhifeng\",\"jiayu\",\"kaiguang\"]\n",
    "password_list = [123456,787898,234546]\n",
    "age_list = [23,35,25]\n",
    "\n",
    "# 列表的嵌套\n",
    "info_list = [[\"hongzhou\",123456,23],[\"zhifeng\",787898,35]]\n",
    "\n",
    "# print(users_list[0])\n",
    "# print(password_list[0])\n",
    "# print(age_list[0])\n",
    "# print(info_list[-1])\n",
    "\n",
    "\n",
    "# -3，-2，-1，0，1，2\n",
    "names = [\"ab\",\"cd\",\"ef\",\"gh\"]\n",
    "# 知识点 slices（切片） 数值是指valus在list中的位置\n",
    "# list 取值” ：“右边的值取不到 例如[1:3] 3这个值取不到\n",
    "print(names[1:3])\n",
    "print(names[0:2])\n",
    "# 如果 左侧的值是0 即从0开始取值，0可以省略不写\n",
    "print(names[:2])\n",
    "\n",
    "# 2.反向取值\n",
    "# list取值 ” ：“右边的值取不到 例如[-3:-1] -1 这个位置取不到\n",
    "# 注意：取到最后一个值，不能写 0 省略不写即可\n",
    "print(names[-3:1])\n",
    "\n",
    "num = [1,2,3,4,5,6,7,8,9]\n",
    "# 对比 range\n",
    "print(num[:7:3])\n",
    "print(list(range(10)))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
